package main

import (
	"time"
	"fmt"
	"math/rand"
)

func main()  {

	//0.时间戳
	//1.获取变化种子
	//2.获取随机数

	t1 := time.Now()
	ss := t1.Unix()
	fmt.Println(ss)

	sss := t1.UnixNano()
	fmt.Println(sss)

	//rand.Seed(ss)
	//num := rand.Intn(20)
	//fmt.Println(num)

	for i:=0; i<200; i++ {
		seed := time.Now().UnixNano()
		rand.Seed(seed)
		time.Sleep(100000000)
		fmt.Println(i, rand.Intn(100), seed)

		//[m,n]
		//rand.Intn(n-m+1)+m		-----------------随机数
		num := rand.Intn(100+1)	//随机数


	}




	//f1()
	//f2()

}

func f1 () {
	seed := time.Now().UnixNano()
	rand.Seed(seed)

	for i:=0; i<100; i++ {
		fmt.Println(i, rand.Intn(100), seed)
	}
}



//随机数-----  更换种子
func f2() {
	for i:=0; i<100; i++ {
		seed := time.Now().UnixNano()
		rand.Seed(seed)

		fmt.Println(i, rand.Intn(100), seed)
		time.Sleep(100000000)
	}
}